home *** CD-ROM | disk | FTP | other *** search
/ Mac Installer 3 / Mac Installer Volume 3 (1996).iso / mac / MM Director 5.0 / FileFlex Lite / FileFlex Xtras / -Database Designer / 00006_KeyInput Script.ls < prev    next >
Encoding:
Text File  |  1996-10-15  |  1.5 KB  |  54 lines

  1. on keyDown
  2.   global keyEditOK, fieldSpec
  3.   if keyEditOK = 0 then
  4.     exit
  5.   end if
  6.   case the frameLabel of
  7.     "Create":
  8.       set theField to "FieldEntry"
  9.       set maxChars to 10
  10.       set validChars to "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
  11.       set valid1stChars to "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  12.   end case
  13.   if (the key = ENTER) or (the key = RETURN) then
  14.     if field theField <> "_" then
  15.       case the frameLabel of
  16.         "Create":
  17.           doCreateOK()
  18.       end case
  19.     end if
  20.   else
  21.     if the key = BACKSPACE then
  22.       set numChars to the number of chars in field theField
  23.       if numChars > 1 then
  24.         if numChars > 2 then
  25.           put char 1 to numChars - 2 of field theField & "_" into field theField
  26.         else
  27.           put "_" into field theField
  28.         end if
  29.       end if
  30.     else
  31.       set numChars to the number of chars in field theField
  32.       if numChars <= maxChars then
  33.         if numChars = 1 then
  34.           if valid1stChars contains the key then
  35.             put toupperC(the key) & "_" into field theField
  36.           end if
  37.         else
  38.           if validChars contains the key then
  39.             put char 1 to numChars - 1 of field theField & toupperC(the key) & "_" into field theField
  40.           end if
  41.         end if
  42.       end if
  43.     end if
  44.   end if
  45. end
  46.  
  47. on toupperC theChar
  48.   if (charToNum(theChar) >= 97) and (charToNum(theChar) <= 122) then
  49.     return numToChar(charToNum(theChar) - 32)
  50.   else
  51.     return theChar
  52.   end if
  53. end
  54.